$(function () {
    $(".inp").on("click", function () {
        var $inp = $("#inputEmail").val()
        var $pwd = $("#inputPassword").val()
        var url = "http://localhost/5lux/svrer/register.php"
        xhrGet(url, {
                username: $inp,
                password: $pwd
            })
            .then(function (res) {
                res = JSON.parse(res);
                // 前端逻辑 => 给用户一个提示;
                if (res.state === "error") {
                    alert_ele.style.display = "block";
                    alert_ele.innerHTML = res.msg;
                    // 错误提示稍后直接隐藏即可;
                    setTimeout(function () {
                        alert_ele.style.display = "none";
                    }, 2000)
                } else if (res.state === "success") {
                    location.assign("./login.html");
                }
            })
    })
})